<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form class="form-horizontal" role="form" id="update_form">
    <input type="hidden" name="roleId" id="roleId" th:value="${role.roleId}">
    <div class="form-group">
        <label for="roleName" class="col-sm-2 control-label">角色名称</label>
        <div class="col-sm-5">
            <input type="text" class="form-control" id="roleName" th:value="${role.roleName}" name="roleName" placeholder="请输入角色名字">
        </div>
    </div>
    <div class="form-group">
        <label for="menu" class="col-sm-2 control-label">权限</label>
        <div class="col-sm-5">
            <div class="zTreeDemoBackground left" id="menu">
                <ul id="treeDemo" class="ztree"></ul>
            </div>
        </div>
    </div>
</form>
</body>
</html>
<script>
    var setting = {
        check:{
            enable: true,
            autoCheckTrigger :true
        },
        async: {
            enable: true,
            url: "/menu/getZtreeMenuChecked?roleId=" + $("#roleId").val(),
        },

    };

    $(document).ready(function(){
        $.fn.zTree.init($("#treeDemo"), setting);
    });
</script>